package cn.jdx;

import cn.jdx.listener.MyListener;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class AppApplication {

    public static void main(String[] args) {
        SpringApplication.run(AppApplication.class, args);
    }

    @Bean //(3)注册为bean
    public ServletListenerRegistrationBean<MyListener> getServletListenerRegistrationBean(){
        ServletListenerRegistrationBean<MyListener> bean =
                new ServletListenerRegistrationBean<>(new MyListener());
        bean.setOrder(1);//(4).设置优先级别
        return bean;
    }
}
